package com.qf.exception;

import com.qf.common.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * ==== 天道酬勤 ====
 *
 * @author douzhouzhou
 * @date 2025/2/26
 * <p>
 * ==== 行稳致远 进而有为 ====
 */
/*
 * 全局异常处理器
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(CustomerException.class)
    public Object customerException(CustomerException e) {
        return R.fail(e.getCode(), e.getMsg());
    }
    @ExceptionHandler(Exception.class)
    public Object exception(Exception e) {
        e.printStackTrace();
        return R.fail("未知异常");
    }
}
